aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/accepted/[text]/+page.svelte
blob: 1483a294d32f93e84bd6dc3ee34fb69cbb89b0e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<script>
  import Icon from "$comp/Icon.svelte";
  import Qr from "$comp/Qr.svelte";
  import { back, copy } from "$lib/utils";
  import { bech32 } from "@scure/base";
  import { page } from "$app/stores";
  import { PUBLIC_DOMAIN } from "$env/static/public";

  let { encode, toWords } = bech32;
  let { data } = $props();
  let { nfc, text } = $derived(data);
  let { username } = $derived(data.subject);
  let url = `https://coinos.io/p/${username.toLowerCase()}`;

  let lnurl = $derived(
    `https://${PUBLIC_DOMAIN}/ln/${encode(
      "lnurl",
      toWords(
        new TextEncoder().encode(`https://${PUBLIC_DOMAIN}/p/${username}`),
      ),
      20000,
    )}`,
  );
</script>

<div class="px-2">
  <div
    class="border-8 border-black p-8 max-w-[580px] mx-auto mt-20 space-y-2 rounded-3xl relative"
  >
    <div class="flex gap-2 mx-auto justify-center">
      <!-- <img src="/images/bitcoin.png" class="w-16 h-16 my-auto" /> -->
      <img src="/images/bitcoin-logo.png" class="my-auto w-[400px]" />
      <!-- <h3 class="text-5xl font-bold text-center my-auto"> -->
      <!--   bitcoin -->
      <!-- </h3> -->
    </div>
    {#if nfc}
      <img
        src="/images/tap.png"
        class="w-24 absolute top-52 left-4 rotate-[-10deg]"
      />
      <img
        src="/images/arrow.png"
        class="w-24 scale-x-[-1] rotate-[120deg] absolute top-52 left-32 w-20 h-52"
      />
    {/if}
    <Qr {text} icon="icon.png" />
    <div class="text-center text-4xl font-bold break-all">
      coinos.io/{username.toLowerCase()}
    </div>
  </div>

  <button onclick={() => copy(lnurl)} class="flex gap-1 m-auto my-8">
    <iconify-icon icon="ph:copy-bold" width={32}></iconify-icon>
    LNURL</button
  >
</div>